//
//  ViewController.m
//  WebpDemo
//
//  Created by 徐结兵 on 2018/5/11.
//  Copyright © 2018年 八维通. All rights reserved.
//

#import "ViewController.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import <SDWebImage/UIImage+WebP.h>

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 300, 180)];
    imageView.center = self.view.center;
    NSURL *url = [NSURL URLWithString:@"http://omhi7r2wt.bkt.clouddn.com/image/20180511/640.webp"];
//    NSData *data = [NSData dataWithContentsOfURL:url];
//#ifdef SD_WEBP
//    [imageView setImage:[UIImage sd_imageWithWebPData:data]];
//#endif
    
    UIImage *image = [UIImage imageNamed:@"image.jpg"];
    [imageView sd_setImageWithURL:url placeholderImage:image];
    [self.view addSubview:imageView];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
